package reduce.fz.com.reduce.fragment;


import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.adapter.BaseListAdapter;
import reduce.fz.com.reduce.adapter.BaseRecycleViewHolder;
import reduce.fz.com.reduce.bean.OfficialNotify;
import reduce.fz.com.reduce.fragment.base.BaseListFragment;

/**
 * A simple {@link Fragment} subclass.
 */
public class TongzhiNotifyFragment extends BaseListFragment {
    private String requestUrl = "";


    public TongzhiNotifyFragment() {
    }

    @Override
    public BaseRecycleViewHolder createItemViewHolder(ViewGroup parent) {
        View view = layoutInflater.inflate(R.layout.tongzhi_notify_item, null);
        GuanzhuNotifyFragment.MyVieHolder holder = new GuanzhuNotifyFragment.MyVieHolder(view);
        return holder;
    }

    @Override
    public BaseRecycleViewHolder createfootViewHolder(View view) {
        return null;
    }

    @Override
    public String createReqUrl() {
        return requestUrl;
    }


    public  static class MyViewHolder extends BaseRecycleViewHolder<OfficialNotify> {
        private TextView tv_pub_time;
        private TextView notify_desc;
        private ImageView iv_notify_image;


        public MyViewHolder(View itemView) {
            super(itemView);
            tv_pub_time = (TextView) itemView.findViewById(R.id.tv_pub_time);
            notify_desc = (TextView) itemView.findViewById(R.id.notify_desc);
            iv_notify_image = (ImageView) itemView.findViewById(R.id.iv_notify_image);
        }

        @Override
        public void renderView(OfficialNotify data,int position) {

            tv_pub_time.setText(data.pubdate + "");
            notify_desc.setText(data.desc);
            Picasso.with(context).load(data.iconUrl).into(iv_notify_image);

        }
    }


}
